/* 角色管理api */
import { user } from "@/api/request";
/* 获取用户 */
export function get(parameter: object) {
  return user({
    url: `/role`,
    method: "get",
    params: parameter,
  });
}
export function add(data: object) {
  return user({
    url: `/role`,
    method: "post",
    data: data,
  });
}

/* 更新项目 */
export function update(data: object) {
  return user({
    url: `/role/update`,
    method: "post",
    data: data,
  });
}

export function del(id: number) {
  return user({
    url: `/role/delete/${id}`,
    method: "get",
  });
}
export function getResources(parameter: object) {
  return user({
    url: `/roleresource`,
    method: "get",
    params: parameter,
  });
}
export function getotherresources(parameter: object) {
  return user({
    url: `/roleresource/otherresource`,
    method: "get",
    params: parameter,
  });
}
export function delResources(parameter: object) {
  return user({
    url: `/roleresource/deletebyroleresource`,
    method: "get",
    params: parameter,
  });
}
export function addroleresource(data: object) {
  return user({
    url: `/roleresource`,
    method: "post",
    data: data,
  });
}
export default {
  get,
  add,
  update,
  del,
  getResources,
  delResources,
  addroleresource,
  getotherresources,
};
